//
//  ValidateHelper.h
//  SCRM
//
//  Created by sotao on 14-9-29.
//  Copyright (c) 2014年 APP. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <MediaPlayer/MediaPlayer.h>
#import "MLEmojiLabel.h"
#import "sys/utsname.h"
#define NUMBERS @"0123456789\n"
#import "MyLatLng.h"


@interface ValidateHelper : NSObject

+ (NSString *)deviceString;

#pragma mark - 验证输入是否为数字
+ (BOOL)isValidateNumber:(NSString *)number;

#pragma mark - 验证手机号码格式
+ (BOOL)isValidateMobile:(NSString *)mobile;

#pragma mark - 验证邮箱格式
+ (BOOL)isValidateEmail:(NSString *)email;

#pragma mark - 验证密码格式
+ (BOOL)isValidatePassword:(NSString *)password;

#pragma mark - 验证double
+ (BOOL)isValidateDoubleStr:(NSString *)doubleStr;

#pragma mark - 转换时间戳
+(NSString *) dateFromDouble:(double)timeDouble;

#pragma mark - UITextField 和 UILabel
+ (UITextField *)textFieldValue0;
+ (UITextField *)textFieldValue;
+ (UITextField *)textFieldValue2;
+ (UILabel *)labelFieldValue:(NSString *)string;

#pragma mark - 排除无效数据
+(id)isValueNull:(id)value;
+(NSString *)judgeisNSStringNull:(id)value TypeCode:(NSInteger)typeCode;

#pragma mark - 读取UserDefault数据
+(id)readUserDefaultObjectValueForKey:(NSString*)aKey;
+(void)writeUserDefaultObjectValue:(NSObject*)aValue withKey:(NSString*)aKey;
+(void)clearUserDefaultWithKey:(NSString *)key;
+(void)createList;

#pragma mark - label
+(NSAttributedString *)LabelColorCombinationsWithValues1:(NSString *)values1 Values2:(NSString *)values2 Values3:(NSString *)values3;

+(NSString *) md5: (NSString *) inPutText;
#pragma mark -3次MD5加密
+ (NSString *)myThreedMD5:(NSString *)str;

#pragma mark - 判断图片地址 有无http打头字符
+(BOOL) isHttpHead:(NSString *)urlStr;

#pragma mark -- 打印 组装http链接
+(void)httpgetUrlWithDic:(NSMutableDictionary *)tempDic httpUrlHead:(NSString *)httpUrlHead;

//json字符串转为dictionary
+(NSMutableDictionary *)jsonStringToDictionary:(NSString *)parameter;

//字典转换为json字符串
+(NSString *)aryToString:(NSMutableArray *)ary;


//NSString转换为NSData
+(NSData *)stringToData:(NSString *)str;

//NSData转换为NSString
+(NSString *)dataToString:(NSData *)data;

//NSData转换为char
//+(char *)dataToChar:(NSData *)data;

//char转换为NSData
+(NSData *)charToData:(Byte *)byte;

//由 NSDate 转换为 NSString:
+(NSString *)dateToString:(NSDate *)theDate FormatterStr:(NSString *)formatterStr;

//由 NSString 转换为 NSDate:
+(NSDate *)stringToDate:(NSString *)dateStr FormatterStr:(NSString *)formatterStr;

+(NSInteger)cTimestampFromDate:(NSDate *)date;
+ (NSDate *)dateFromString:(NSString *)timeStr
                    format:(NSString *)format;

/**
 *  字符串转时间戳
 *
 *  @param theTime 字符串时间
 *  @param format  转化格式 如yyyy-MM-dd HH:mm:ss,即2015-07-15 15:00:00
 *
 *  @return 返回时间戳的字符串
 */
+(NSInteger)cTimestampFromString:(NSString *)timeStr
                          format:(NSString *)format;

//获取设备唯一标识
+(NSString *)getID;
//时间戳 转 时间格式字符串
+(NSString *)doubleConvertDate:(double)timeDouble FormatterStr:(NSString *)formatterStr;

//6位随机数验证码
+ (int)randomCode;
//距离格式化
+(NSString *)DistanceFormat:(NSString*)dis;


//计算字符串固定宽度的高
+ (CGSize)sizeOfText:(NSString *)text theFont:(UIFont*)font theWidth:(float)width;

//计算字符串宽高
+ (CGSize)sizeOfText:(NSString *)text theFont:(UIFont*)font;
//泡泡文本
+ (UIView *)bubbleView:(NSString *)text from:(BOOL)fromSelf withPosition:(int)position;
//时间戳转字符串（今天 13：22，昨天13：44）
+ (NSString*)timeStringWith:(NSTimeInterval)timestamp multiLine:(BOOL)multi;
//过滤表情
+ (NSString *)FilterExpression:(NSString *)html;
#pragma mark 通过URL获取图片高度
+(CGFloat )setimgeSize:(NSString *)url img:(UIImageView *)img;

//替换表情
+ (void)ReplaceExpression:(NSString *)st label:(UITextView *)textview;
+ (void)ReplaceExpression:(NSString *)st label:(UITextView *)textview size:(int)size;
+ (void)ReplaceExpression:(NSString *)st label:(UITextView *)textview size:(int)size isr:(BOOL)isr;

//+ (void)ReplaceMLEmojiLabel:(NSString *)st emojilable:(MLEmojiLabel *)emojilable;
+(NSArray *)ReplaceMLEmojiLabel:(NSString *)st emojilable:(MLEmojiLabel *)emojilable;

//播放
+(MPMoviePlayerController *)bofang:(NSURL *)url;
//根据视频地址获取视频第一针图
+ (UIImage*) thumbnailImageForVideo:(NSURL *)videoURL atTime:(NSTimeInterval)time;

+ (void) hideTabBar:(UITabBarController *) tabbarcontroller;
+ (void) showTabBar:(UITabBarController *) tabbarcontroller;
//金额格式化
+(NSString *)numberFormat:(NSString *)number;

+(CGFloat)GetJiaoDu:(MyLatLng *)A b:(MyLatLng *)B;
+(NSMutableDictionary *)outFangxiang:(MyLatLng *)A b:(MyLatLng *)B;
//改变Lable中的其中一部分字的颜色
+(void)colorLable:(UILabel *)lable str:(NSString *)str key:(NSString *)key;
//改变Lable中的其中一部分字的颜色(任何)
+(void)colorLable:(UILabel *)lable str:(NSString *)str key:(NSString *)key color:(UIColor *)color size:(int)size;

//时间戳转年纪
+(NSString *)timeToAge:(NSString *)time;
//设置图片
+(void)setImage:(NSString *)url img:(UIImageView *)img istoux:(BOOL)istx;
//获取拼音首字母(传入汉字字符串, 返回大写拼音首字母)
+ (NSString *)firstCharactor:(NSString *)aString;
//联系人格式化
+(NSMutableArray *)dataFrom:(NSMutableArray *)ary;
+(NSString *)stringAge:(NSString *)str;
//获取html字符串里面的图片和title
+ (NSMutableDictionary  *)GetHtmlImgOrTitle:(NSString *)html;
//清除html标签
+ (NSString *)cleanlHTML:(NSString *)html;

+ (NSString *)distanceTimeWithBeforeTime: (double)beTime;
//根据url获取sd缓存的图片
+(UIImage*)imageFromSdcache:(NSString *)urlStr;

+(NSString *)GetWifiName;

+(BOOL)isMobileNum: (NSString *)strMobile;

 @end
